# celery　　定义任务
from celery_tasks.sms.yuntongxun.ccp_sms import CPP
from . import constants
from celery_tasks.main import celery_app


"""使用装饰器装饰异步任务,保证celery识别任务"""
@celery_app.task(name="send_sms_code")
def send_sms_code(mobile, sms_code):
    """
    发送短信验证码的异步请求
    :param mobile: 　手机
    :param sms_code: 　验证码
    :return:  成功０　失败－１
    """
    send_ret = CPP().send_templates_msm(mobile, [sms_code, constants.SMS_CODE_REDIS_EXPIRES // 60], constants.SEND_SMS_TEMPLATE_ID)
    return send_ret